<meta charset="UTF-8">

<h1>会员中心</h1>
<div>张三，退出</div>
<script>
    //获取内存中的存储数据
    let sessionUname=sessionStorage.getItem('uname')
    let localUname=(new Date).getTime()>localStorage.getItem('expires') ? null:localStorage.getItem('uname')
    let uname=localUname || sessionUname
    // console.log(uname)
    if(uname){
        document.querySelector('div').innerHTML=`
        ${uname},欢迎回来
        <a href='./logout.html'>退出</a>
        `
    } else {
        document.querySelector('div').innerHTML=`
        <a href='./demo.html'>请登录</a>
        `
    }

</script>